k = int(input())

s1 = 0
s5 = 0
s10 = 0

for i in range(k):
    n = int(input())
    if n == 1:
        s1 = s1 + 1
    elif n == 5:
        s5 = s5 + 1
    elif n == 10:
        s10 = s10 + 1

print(s1)
print(s5)
print(s10)
